package cn.virens.web.components.shiro;

import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.subject.Subject;

import cn.virens.exception.APIException;

public interface ShiroRealmInterface {
	/**
	 * 清空授权信息
	 * 
	 * @param principals
	 */
	void clearAuthorizationInfo(PrincipalCollection principals);

	/**
	 * 清空授权信息
	 * 
	 * @param subject
	 */
	default void clearAuthorizationInfo(Subject subject) {
		if (subject == null) { throw new APIException("Null", "Subject is null!"); }

		clearAuthorizationInfo(subject.getPrincipals());
	}
}
